package KASystem;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.Date;

/**
 *
 * @author DJH
 */
class Daytrip implements Serializable {

    String name;
    int price;
    String day;
    ArrayList<Companion> companionsOnTrip;

    public Daytrip(String name, String day, int price) {
        this.name = name;
        this.day = day;
        this.price = price;
        companionsOnTrip = new ArrayList<>();

    }

    /*
     * addar companion til listan av participants til hendan daytrip
     */
    public void addCompanion(Companion companion) {

        if (!companionsOnTrip.contains(companion)) {
            companionsOnTrip.add(companion);
        }
    }

    /*
     * @return name
     */
    public String getName() {
        return name;
    }

    /*
     * @return price
     */
    public int getPrice() {
        return price;
    }

    /**
     *
     * @return ArrayList av companions on this trip
     */
    public ArrayList<Companion> getcompanionsOnTrip() {
        return companionsOnTrip;
    }

    public String stringCompanionList() {
        String txt = "Name of Companions on trip;\n";
        for (Companion i : companionsOnTrip) {
            txt += i.getName() + "\n";
        }
        return txt;
    }

    @Override
    public String toString() {
        return name + " | " + day + " | " + price;
    }
}
